package com.micro.app.config;

import com.micro.app.client.FeignClientService;
import com.micro.common.constant.R;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author pan.shun
 * @version 2.0
 * @since 2022/7/13 20:40
 */
@Component
public class FeignCallBackFactoryConfig implements FallbackFactory<FeignClientService> {

    @Override
    public FeignClientService create(Throwable throwable) {
        return new FeignClientService() {
            @Override
            public R getDictByCode(String dictCode, String appId) {
                return R.error("连接超时，请稍后再试");
            }
        };
    }
}